<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>document</title>
</head>

<body>
    <!-- 准备一个“容器” -->
    <div id="test"></div>

    <!-- 引入 react 核心库 -->
    <script src="../js/17.0.1/react.development.js"></script>
    <!-- 引入 react-dom. 用于支持 react 操作 dom -->
    <script src="../js/17.0.1/react-dom.development.js"></script>
    <!-- 引入babel. 用于将 jsx 转换为 js -->
    <script src="../js/17.0.1/babel.min.js"></script>
    <script type="text/babel"> /* 这里必须写 babel */
        // 创建 DOM
        class Time extends React.Component {
            state = {date:new Date()}
            componentDidMount(){
                setInterval(() => {
                    this.setState({date:new Date})
                },1000)
            }
            render() {
                return (
                    <div>
                        <h1>hello</h1>
                        <input type="text" name="" id="" />
                        <span>现在是：{this.state.date.toTimeString()}</span>
                    </div>
                )
            }
        }
        ReactDOM.render(<Time/>,document.getElementById("test"))
    </script>
</body>

</html>